<?php 
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/env.inc.php';

$menuPages = new Menu(0, 'admin-menu-r', true, true);
$siteComponent = new Site();
$threePages = $siteComponent->getThreePages(0, 0);

?>
<div class="admin-new-page">
	<h2>Admin pages</h2>
	
	<?php 
	if ($user->asPermission('mod_page')) {?>
	<select name="parent-page" class="admin-r-select">
		<option value="0"> - - -</option>
		<?php 
		foreach ($threePages as $ele) {
			
			if ($ele["id"] == $_POST["idPage"]) {
				$selected = ' selected="true" ';
			} else {
				$selected = '';
			}
			
			$padding = '&nbsp;';
			for($j=0; $j<$ele["livel"]; $j++) {
				$padding .= '&nbsp;&nbsp;';
			}
			
			echo '<option value="'.$ele["id"].'"'.$selected.'>'.$padding.'|_'.$translate->traslate($ele["name"], $_SESSION["LANGUAGE"]).'</option>';
		}
		?>
	</select>
	
	<input type="text" name="new-page" class="admin-r-input" value="" />
	<a id="new-page" href="javascript:;"><img src="/img/ico/admin/page-add.png" title="New page" /></a>
	<?php 
	} //endif?>
	
</div>

<?php 
echo $translate->traslate($menuPages->html(), $_SESSION["LANGUAGE"]); 
?>